<?php

/**
 * Storms form base class.
 *
 * @method Storms getObject() Returns the current form's model object
 *
 * @package    TMD
 * @subpackage form
 * @author     Thaihosting
 */
abstract class BaseStormsForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'ISTORM_ID'  => new sfWidgetFormInputHidden(),
      'SNAME_ENG'  => new sfWidgetFormInputText(),
      'SNAME_THAI' => new sfWidgetFormInputText(),
      'SMEANING'   => new sfWidgetFormTextarea(),
      'SORIGIN'    => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'ISTORM_ID'  => new sfValidatorChoice(array('choices' => array($this->getObject()->getIstormId()), 'empty_value' => $this->getObject()->getIstormId(), 'required' => false)),
      'SNAME_ENG'  => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'SNAME_THAI' => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'SMEANING'   => new sfValidatorString(array('max_length' => 2147483646, 'required' => false)),
      'SORIGIN'    => new sfValidatorString(array('max_length' => 100, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('storms[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Storms';
  }


}
